package com.example.nophase.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.nophase.R;
import com.example.nophase.entity.FinanceMsgItem;
import com.example.nophase.entity.UserDTO;

import java.util.List;

public class FinanceMsgAdapter extends BaseAdapter {
    List<UserDTO> list;
    Context context;

    public FinanceMsgAdapter(List<UserDTO> list, Context context) {
        this.list = list;
        this.context = context;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = LayoutInflater.from(context).inflate(R.layout.finance_mag_layout,null);
        TextView finance_name = view.findViewById(R.id.finance_lv_name);
        TextView finance_msg = view.findViewById(R.id.finance_lv_msg);

        finance_name.setText(list.get(position).getUsername());
        finance_msg.setText(list.get(position).getFinanceArea());
        return view;

    }
}
